# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataMigration.V1.Model.ConstraintEntity do
  @moduledoc """
  Constraint is not used as an independent entity, it is retrieved as part of another entity such as Table or View.

  ## Attributes

  *   `customFeatures` (*type:* `map()`, *default:* `nil`) - Custom engine specific features.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the table constraint.
  *   `referenceColumns` (*type:* `list(String.t)`, *default:* `nil`) - Reference columns which may be associated with the constraint. For example, if the constraint is a FOREIGN_KEY, this represents the list of full names of referenced columns by the foreign key.
  *   `referenceTable` (*type:* `String.t`, *default:* `nil`) - Reference table which may be associated with the constraint. For example, if the constraint is a FOREIGN_KEY, this represents the list of full name of the referenced table by the foreign key.
  *   `tableColumns` (*type:* `list(String.t)`, *default:* `nil`) - Table columns used as part of the Constraint, for example primary key constraint should list the columns which constitutes the key.
  *   `tableName` (*type:* `String.t`, *default:* `nil`) - Table which is associated with the constraint. In case the constraint is defined on a table, this field is left empty as this information is stored in parent_name. However, if constraint is defined on a view, this field stores the table name on which the view is defined.
  *   `type` (*type:* `String.t`, *default:* `nil`) - Type of constraint, for example unique, primary key, foreign key (currently only primary key is supported).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :customFeatures => map() | nil,
          :name => String.t() | nil,
          :referenceColumns => list(String.t()) | nil,
          :referenceTable => String.t() | nil,
          :tableColumns => list(String.t()) | nil,
          :tableName => String.t() | nil,
          :type => String.t() | nil
        }

  field(:customFeatures, type: :map)
  field(:name)
  field(:referenceColumns, type: :list)
  field(:referenceTable)
  field(:tableColumns, type: :list)
  field(:tableName)
  field(:type)
end

defimpl Poison.Decoder, for: GoogleApi.DataMigration.V1.Model.ConstraintEntity do
  def decode(value, options) do
    GoogleApi.DataMigration.V1.Model.ConstraintEntity.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DataMigration.V1.Model.ConstraintEntity do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
